Skip to content

chore(deps): migrate to famedly-zitadel-rust-client v0.12 - #164

Open
nikzen wants to merge 4 commits into
mainfrom
chore/migrate-zitadel-rust-client-v0.12
Open

chore(deps): migrate to famedly-zitadel-rust-client v0.12#164
nikzen wants to merge 4 commits into
mainfrom
chore/migrate-zitadel-rust-client-v0.12

Conversation

@nikzen

@nikzen nikzen commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates the Zitadel client dependency from famedly-zitadel-rust-client v0.3.0 to v0.12 (currently pinned to 0.12.2 in Cargo.lock), dropping the legacy v1 API feature. This resolves the remaining security advisories on the old dependency line.

Client version status

  • Cargo.toml requires version = "0.12"; Cargo.lock resolves to v0.12.2 (commit 2feabec).
  • v0.12.2 is the latest v0.12.x release upstream. Newer v0.13.x exists (breaking: reqwest_middleware-based client constructor, new update method, create_invite_code), but is intentionally not part of this migration.
  • All APIs this tool uses (create_human_user, add_user_grant, set_user_metadata, search_user_grants, list_users, Token) are unchanged between v0.12.2 and v0.13.1; v0.13's create_invite_code is not yet adopted here — the follow-up fix (fix: Send first-login invitations to provisioned users (FP-295) #166) ships its own raw-HTTP invitation extension, which can migrate to the native method in a later dependency bump.

What changed

  • (deps) Migrate to famedly-zitadel-rust-client v0.12, drop the v1 feature
  • (zitadel) Match Zitadel error codes across the full v2 error chain, restoring the "user already exists" update path and the invalid-phone fallback
  • (tests) Migrate the e2e suite from the gRPC v1 client to the v2 HTTP API

Merge notes

GitHub currently reports this PR as CONFLICTING/DIRTY with main, but the conflicts are confined to version-marker lines:

  • CHANGELOG.md — main gained the 0.11.3 entry; branch carries 0.12.0 on top of 0.11.2
  • Cargo.toml / Cargo.lockversion = "0.11.3" vs 0.12.0 and the dependency lines above
  • src/lib.rs auto-merges; the UKT no-users fix (#65c0759) and the new import_source_user helper touch disjoint regions

Resolution direction: keep the branch's 0.12.0 version and v0.12 dependency, keep main's 0.11.3 entry above 0.12.0 in the changelog (or reorder by date), take main's UKT change in Cargo.lock.

Bump the Zitadel client from the legacy zitadel-rust-client v0.3 to
famedly-zitadel-rust-client v0.12 and migrate the e2e test suite off the
gRPC v1 API onto the v2 HTTP API, dropping the v1 dev-dependency feature
that carried the remaining security advisories.

Fix two error-handling regressions in src/zitadel.rs surfaced by running
the e2e suite against the v2 production code: the v2 client exposes
Zitadel error codes (V3-DKcYh, PHONE-so0wa, COMMAND-ieJ2e) as a source in
the error chain rather than in the top-level Display. Match against the
full chain via `{error:#}` to restore the "user already exists" update
path and the invalid-phone fallback in both import_user and update_user.

Co-authored-by: Cursor <cursoragent@cursor.com>
@nikzen
nikzen requested a review from a team as a code owner June 20, 2026 15:49
Co-authored-by: Cursor <cursoragent@cursor.com>
@nikzen nikzen changed the title chore(deps): migrate to famedly-zitadel-rust-client v0.12 release: v0.12.0 — migrate to famedly-zitadel-rust-client v0.12 Jun 20, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.22642% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.99%. Comparing base (13f740d) to head (21fc327).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/zitadel.rs 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #164      +/-   ##
==========================================
+ Coverage   91.37%   91.99%   +0.61%     
==========================================
  Files          10       10              
  Lines        1600     1648      +48     
==========================================
+ Hits         1462     1516      +54     
+ Misses        138      132       -6     
Files with missing lines Coverage Δ
src/lib.rs 90.85% <100.00%> (+11.00%) ⬆️
src/zitadel.rs 88.05% <85.71%> (+1.50%) ⬆️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13f740d...21fc327. Read the comment docs.

The pinned CI nightly denies these pedantic lints via `-D warnings`.

- Extract import/delete/update arms of `sync_users` into helper functions.
- Hoist test-local items (fixtures, helpers) to module scope, since the
  test macros emit statements before them, tripping items_after_statements.
- Split the long install-ids/UKT test bodies into seeding helpers and add
  `#![cfg(test)]` to install-ids.rs so expect-in-tests is allowed.

Co-authored-by: Cursor <cursoragent@cursor.com>

@sirewix sirewix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok on the surface, but there are so many changes in test code. If we want to verify everything it will take a lot of time

Comment thread Cargo.toml
uuid = { version = "1.10.0", features = ["v5"] }
wiremock = "0.6.2"
zitadel-rust-client = { git = "https://github.com/famedly/zitadel-rust-client", version = "0.3.0", default-features = false }
zitadel-rust-client = { git = "https://github.com/famedly/zitadel-rust-client", package = "famedly-zitadel-rust-client", version = "0.12", default-features = false }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the version from crates.io

Comment thread CHANGELOG.md

### Miscellaneous Tasks

- *(deps)* Migrate to famedly-zitadel-rust-client v0.12 and drop the v1 feature, resolving the remaining security advisories

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was only used in tests, so probably there was no real security issues

Comment thread src/zitadel.rs
// error code we match on below) as a source in the error chain,
// so we must inspect the full chain rather than just the
// top-level `Display`.
let error_chain = format!("{error:#}");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let error_chain = format!("{error:#}");
let error_chain = format!("{error:?}");

Comment thread src/zitadel.rs
// error chain, so we match against the whole chain.
// If the new phone number is invalid
if error.to_string().contains("PHONE-so0wa") {
if format!("{error:#}").contains("PHONE-so0wa") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if format!("{error:#}").contains("PHONE-so0wa") {
if format!("{error:?}").contains("PHONE-so0wa") {

Comment thread src/zitadel.rs
if let Err(error) = self.zitadel_client.remove_phone(zitadel_id).await {
// If the user didn't start out with a phone
if !error.to_string().contains("COMMAND-ieJ2e") {
if !format!("{error:#}").contains("COMMAND-ieJ2e") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if !format!("{error:#}").contains("COMMAND-ieJ2e") {
if !format!("{error:?}").contains("COMMAND-ieJ2e") {

Comment thread tests/install-ids.rs
@@ -1,5 +1,7 @@
//! E2E tests for the id installation script

#![cfg(test)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#![cfg(test)]

@nikzen nikzen changed the title release: v0.12.0 — migrate to famedly-zitadel-rust-client v0.12 fix: Send first-login invitations to provisioned users (FP-295) Sep 11, 2026
@nikzen
nikzen force-pushed the chore/migrate-zitadel-rust-client-v0.12 branch from 6c1a44a to 21fc327 Compare September 11, 2026 15:29
@nikzen nikzen changed the title fix: Send first-login invitations to provisioned users (FP-295) chore(deps): migrate to famedly-zitadel-rust-client v0.12 Sep 11, 2026
@nikzen
nikzen added this pull request to stack #167 September 11, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants